package cn.cas.mango.dto.param.hot;

import cn.cas.mango.dto.param.BaseParam;
import cn.cas.mango.util.string.StringUtils;
import co.elastic.clients.elasticsearch._types.FieldValue;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.util.List;
import java.util.Map;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class HotSpotParam extends BaseParam {
  private String overwrite;
  @NonNull
  private String   nm;
  private Integer  currentPage;
  private Integer  pageSize;
  private Double   entityWeight;
  private Double   simWeight;
  private String   query;
  private String   flags;
  private String   province;
  private String   startDate;
  private String   endDate;
  private String   ssly;

  private List<FieldValue> queryArray;
  private List<FieldValue> provinceArray;

  public static HotSpotParam getFromFormData(Map<String, Object> errMessage) {
    HotSpotParam hotSpotParam = (HotSpotParam) errMessage.get("formData");
    hotSpotParam.setQuery(
      StringUtils.preprocessString(hotSpotParam.getQuery())
    );
    return hotSpotParam;
  }


}
